<%= render :partial => "shared/operator_links" %>
<%= will_paginate_locale @orders %>
<table class="adminTableOrders" border="0" width="100%" cellpadding="4" cellspacing="0">
  <tr class="adminTableHeader"><th><%= t("site.cms.label.id") %></th><th><%= t("site.cms.label.status") %></th><th><%= t("site.cms.label.operator") %></th>
    <th><%= "#{t("site.cms.action.show")}/#{t("site.cms.action.edit")}" %></th><th><%= t("site.cms.action.delete") %></th><th><%= t("site.cms.label.created_at") %></th></tr>
  <% @orders.each do |order| %>
    <tr>
      <td><%= order.id %></td>
      <td><%= t "site.cms.operator.order.status.#{order.status}" %></td>
      <td><% operator = User.find(:first, :conditions => ["id = ?", order.operator_id]) %>
        <%= "#{operator.login} - #{operator.firstname} #{operator.lastname} (id: #{operator.id})" if operator %>
      </td>
      <td>
        <% action_text = order.status == 'approved' ? "show" : "edit" %>
        <%= link_to "#{t("site.cms.action.#{action_text}")} #{t("site.cms.entity.order")} #{order.id}", edit_order_path(:id => order.id) %>
      </td>
      <td><%= link_to "#{t("site.cms.action.delete")} #{t("site.cms.entity.order")} #{order.id}", order_path(:id => order.id),
          :method => :delete, :confirm => t("site.cms.label.sure") %></td>
      <td><%= l order.created_at, :format => :long %>  </td>
    </tr>
  <% end %>
</table>
<%= will_paginate_locale @orders %>